package com.heima.comment.controller.v1;

import com.heima.comment.service.CommentRepayService;
import com.heima.comment.service.CommentService;
import com.heima.model.comment.dtos.LikeCommentDto;
import com.heima.model.comment.dtos.QueryCommentsDto;
import com.heima.model.comment.dtos.SaveCommentDto;
import com.heima.model.common.dtos.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author tujian
 * @Date 2022年03月25日 10:39:46
 */
@RestController
@RequestMapping("/api/v1/comment_repay")
@Slf4j
public class CommentRepayComtroller {

    @Autowired
    private CommentService commentService;
    @Autowired
    private CommentRepayService commentRepayService;

    /**
     * 保存回复
     */
    @PostMapping("/save")
    public ResponseResult save(@RequestBody SaveCommentDto dto){
        log.info("保存回复");
        return commentRepayService.save(dto);
    }

    /**
     * 查询评论回复列表
     */
    @PostMapping("/load")
    public ResponseResult load(@RequestBody QueryCommentsDto dto){
        return commentRepayService.load(dto);
    }

    /**
     * 点赞
     */
    @PostMapping("/like")
    public ResponseResult like(@RequestBody LikeCommentDto dto){
        return commentRepayService.like(dto);
    }
}
